#include "stm32f10x.h"                  // Device header
#include "Servos.h"
#include "Delay.h"
#include "Key.h"
#include "OLED.h"

uint8_t KeyNum, Angle;

int main()
{
	Servos_Init();
	OLED_Init();
	Key_Init(GPIO_Pin_0);
	
	OLED_ShowString(1, 1, "Angle:");
	while(1)
	{
		KeyNum = Key();
		if(KeyNum == 1)
		{
			Angle += 30;
			if(Angle > 180)
				Angle = 0;
			Servos_SetAngle(Angle);
			OLED_ShowNum(1, 7, Angle, 3);
		}
	}
}
